<?php
// First of all, enforce HTTPS
if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') header('Location: https://somanypasswords.com');

defined('APPLICATION_PATH')
    or define('APPLICATION_PATH', dirname(__FILE__));

defined('APPLICATION_ENVIRONMENT')
    or define('APPLICATION_ENVIRONMENT', 'production'); /* Can be development or production */

/* Send no-cache headers */
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 01 Dec 2007 01:00:00 GMT");

/* Set doctype */
$doctype = new Zend_View_Helper_Doctype();
$doctype->doctype('XHTML1_TRANSITIONAL');

/* Start Sessions */
Zend_Session::start();

/* Create ACLs */
NerdPass_Acl::factory();

/* Connect to database */
NerdPass_Data::factory();

/* Setup front controller */
$routes = new Zend_Config_Ini('../application/routes.ini', 'default');
$router = new Zend_Controller_Router_Rewrite();
$router->addConfig($routes, 'routes');

$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory(APPLICATION_PATH . '/controllers')
		   ->setRouter($router)
		   ->setParam('env', APPLICATION_ENVIRONMENT);

unset($controller);